<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>DST2-project: C:/opensource/dst2-projekt/src/kernel.h File Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">DST2-project
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('kernel_8h.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#define-members">Defines</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">C:/opensource/dst2-projekt/src/kernel.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;stdlib.h&gt;</code><br/>
</div>
<p><a href="kernel_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct___t_c_b.html">_TCB</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structmsgobj.html">msgobj</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structmailbox.html">mailbox</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structl__obj.html">l_obj</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct__list.html">_list</a></td></tr>
<tr><td colspan="2"><h2><a name="define-members"></a>
Defines</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kernel_8h.html#a1c5c9d4bb3418209e1fa76041b9d2189">CONTEXT_SIZE</a>&#160;&#160;&#160;13</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6423a880df59733d2d9b509c7718d3a9"></a><!-- doxytag: member="kernel.h::STACK_SIZE" ref="a6423a880df59733d2d9b509c7718d3a9" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>STACK_SIZE</b>&#160;&#160;&#160;100</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa8cecfc5c5c054d2875c03e77b7be15d"></a><!-- doxytag: member="kernel.h::TRUE" ref="aa8cecfc5c5c054d2875c03e77b7be15d" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>TRUE</b>&#160;&#160;&#160;1</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa93f0eb578d23995850d61f7d61c55c1"></a><!-- doxytag: member="kernel.h::FALSE" ref="aa93f0eb578d23995850d61f7d61c55c1" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>FALSE</b>&#160;&#160;&#160;!TRUE</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6fb7181d994ee98e735494be55809708"></a><!-- doxytag: member="kernel.h::RUNNING" ref="a6fb7181d994ee98e735494be55809708" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>RUNNING</b>&#160;&#160;&#160;1</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab5889105dcd019008c9448dff61323f6"></a><!-- doxytag: member="kernel.h::INIT" ref="ab5889105dcd019008c9448dff61323f6" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>INIT</b>&#160;&#160;&#160;!RUNNING</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="abb508ea8227673f419e9fe3a86c30d8e"></a><!-- doxytag: member="kernel.h::FAIL" ref="abb508ea8227673f419e9fe3a86c30d8e" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>FAIL</b>&#160;&#160;&#160;0</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa90cac659d18e8ef6294c7ae337f6b58"></a><!-- doxytag: member="kernel.h::SUCCESS" ref="aa90cac659d18e8ef6294c7ae337f6b58" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>SUCCESS</b>&#160;&#160;&#160;1</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aba51915c87d64af47fb1cc59348961c9"></a><!-- doxytag: member="kernel.h::OK" ref="aba51915c87d64af47fb1cc59348961c9" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>OK</b>&#160;&#160;&#160;1</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad91d8e17ee29c318bd27faeea0b3598a"></a><!-- doxytag: member="kernel.h::DEADLINE_REACHED" ref="ad91d8e17ee29c318bd27faeea0b3598a" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>DEADLINE_REACHED</b>&#160;&#160;&#160;0</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad0c31336be193c6ea8a2e4cc55183bb1"></a><!-- doxytag: member="kernel.h::NOT_EMPTY" ref="ad0c31336be193c6ea8a2e4cc55183bb1" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>NOT_EMPTY</b>&#160;&#160;&#160;0</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afe3a5d0081166bd5e1d8c9ea00db83e5"></a><!-- doxytag: member="kernel.h::SENDER" ref="afe3a5d0081166bd5e1d8c9ea00db83e5" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>SENDER</b>&#160;&#160;&#160;+1</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a455948b8bd5f5ce920899ae1013c4b4c"></a><!-- doxytag: member="kernel.h::RECEIVER" ref="a455948b8bd5f5ce920899ae1013c4b4c" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>RECEIVER</b>&#160;&#160;&#160;-1</td></tr>
<tr><td colspan="2"><h2><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad086a068816d5cbf9ef1f2e77476c069"></a><!-- doxytag: member="kernel.h::exception" ref="ad086a068816d5cbf9ef1f2e77476c069" args="" -->
typedef int&#160;</td><td class="memItemRight" valign="bottom"><b>exception</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1062901a7428fdd9c7f180f5e01ea056"></a><!-- doxytag: member="kernel.h::bool" ref="a1062901a7428fdd9c7f180f5e01ea056" args="" -->
typedef int&#160;</td><td class="memItemRight" valign="bottom"><b>bool</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a91ad9478d81a7aaf2593e8d9c3d06a14"></a><!-- doxytag: member="kernel.h::uint" ref="a91ad9478d81a7aaf2593e8d9c3d06a14" args="" -->
typedef unsigned int&#160;</td><td class="memItemRight" valign="bottom"><b>uint</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa91f46f0fcdf7975411ebb878fd2a05d"></a><!-- doxytag: member="kernel.h::action" ref="aa91f46f0fcdf7975411ebb878fd2a05d" args="" -->
typedef int&#160;</td><td class="memItemRight" valign="bottom"><b>action</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="struct___t_c_b.html">_TCB</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kernel_8h.html#a0c24950e4a367e32a373235c34739781">TCB</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a965c7992c50a9445b5e430dd8e18267f"></a><!-- doxytag: member="kernel.h::msg" ref="a965c7992c50a9445b5e430dd8e18267f" args="" -->
typedef struct <a class="el" href="structmsgobj.html">msgobj</a>&#160;</td><td class="memItemRight" valign="bottom"><b>msg</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa165e1366825a47787db6ff584a32770"></a><!-- doxytag: member="kernel.h::listobj" ref="aa165e1366825a47787db6ff584a32770" args="" -->
typedef struct <a class="el" href="structl__obj.html">l_obj</a>&#160;</td><td class="memItemRight" valign="bottom"><b>listobj</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac8c8d86985b0bf4a1279d23c29b38eba"></a><!-- doxytag: member="kernel.h::list" ref="ac8c8d86985b0bf4a1279d23c29b38eba" args="" -->
typedef struct <a class="el" href="struct__list.html">_list</a>&#160;</td><td class="memItemRight" valign="bottom"><b>list</b></td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kernel_8h.html#aad80019951ae95cf5df515d6d0ad1e93">init_kernel</a> (void)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">exception&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kernel_8h.html#a42bfc62243f10c46ceee0712571ed02e">create_task</a> (void(*body)(), uint <a class="el" href="kernel_8h.html#a415bfbeeec9b4d8eabe0fa37ffd512fa">deadline</a>)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kernel_8h.html#a5354b26c0e92bc241bbaf8daedc5a28c">terminate</a> (void)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kernel_8h.html#a05e0ffe612d44e6d7f3a9ae5b9df56a2">run</a> (void)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structmailbox.html">mailbox</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kernel_8h.html#a28699cab35eb5ea1e91a4e7c1c6b83db">create_mailbox</a> (int nof_msg, int size_of_msg)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="adf1a9f71dea7a3adc2f3787080bfab9c"></a><!-- doxytag: member="kernel.h::no_messages" ref="adf1a9f71dea7a3adc2f3787080bfab9c" args="(mailbox *mBox)" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>no_messages</b> (<a class="el" href="structmailbox.html">mailbox</a> *mBox)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">exception&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kernel_8h.html#a4b1dea31825f9001a59a30454ea4da92">send_wait</a> (<a class="el" href="structmailbox.html">mailbox</a> *mBox, void *pData)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">exception&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kernel_8h.html#abd6f30918419645edbd5c37e4436ee8d">receive_wait</a> (<a class="el" href="structmailbox.html">mailbox</a> *mBox, void *pData)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">exception&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kernel_8h.html#a6a564f8696b23cb7392d26ccf028b81e">send_no_wait</a> (<a class="el" href="structmailbox.html">mailbox</a> *mBox, void *pData)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kernel_8h.html#a712e1920162e49aa4597afe3a066057a">receive_no_wait</a> (<a class="el" href="structmailbox.html">mailbox</a> *mBox, void *pData)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">exception&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kernel_8h.html#ae600d2a164441d7ca5200fe978253a15">wait</a> (uint nTicks)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kernel_8h.html#a8c4a8800ec94acdc9e79f493e175bbba">set_ticks</a> (uint no_of_ticks)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kernel_8h.html#ac8ec696caa3fec38a393173591ab4cac">ticks</a> (void)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kernel_8h.html#a415bfbeeec9b4d8eabe0fa37ffd512fa">deadline</a> (void)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="kernel_8h.html#add8b1bafb2b27062dba1e95c376130de">set_deadline</a> (uint nNew)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac7f665a7995253fc167496bdfd4f0677"></a><!-- doxytag: member="kernel.h::isr_off" ref="ac7f665a7995253fc167496bdfd4f0677" args="(void)" -->
void&#160;</td><td class="memItemRight" valign="bottom"><b>isr_off</b> (void)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a83e26da1090464d1ad80a32408120aa1"></a><!-- doxytag: member="kernel.h::isr_on" ref="a83e26da1090464d1ad80a32408120aa1" args="(void)" -->
void&#160;</td><td class="memItemRight" valign="bottom"><b>isr_on</b> (void)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae0d92bc921159bfdd8cf24eb7d208319"></a><!-- doxytag: member="kernel.h::SaveContext" ref="ae0d92bc921159bfdd8cf24eb7d208319" args="(void)" -->
void&#160;</td><td class="memItemRight" valign="bottom"><b>SaveContext</b> (void)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2649dd366ca39609085f3bec1b5d7cbc"></a><!-- doxytag: member="kernel.h::LoadContext" ref="a2649dd366ca39609085f3bec1b5d7cbc" args="(void)" -->
void&#160;</td><td class="memItemRight" valign="bottom"><b>LoadContext</b> (void)</td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>This file contains most of the typedefinitions and structs. It also contains some global variables and definitions. </p>
</div><hr/><h2>Define Documentation</h2>
<a class="anchor" id="a1c5c9d4bb3418209e1fa76041b9d2189"></a><!-- doxytag: member="kernel.h::CONTEXT_SIZE" ref="a1c5c9d4bb3418209e1fa76041b9d2189" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define <a class="el" href="kernel_8h.html#a1c5c9d4bb3418209e1fa76041b9d2189">CONTEXT_SIZE</a>&#160;&#160;&#160;13</td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Global variabels and definitions </p>

</div>
</div>
<hr/><h2>Typedef Documentation</h2>
<a class="anchor" id="a0c24950e4a367e32a373235c34739781"></a><!-- doxytag: member="kernel.h::TCB" ref="a0c24950e4a367e32a373235c34739781" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef struct <a class="el" href="struct___t_c_b.html">_TCB</a>  <a class="el" href="kernel_8h.html#a0c24950e4a367e32a373235c34739781">TCB</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Task Control Block contains the neccessary tools for handling a task. </p>

</div>
</div>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="a28699cab35eb5ea1e91a4e7c1c6b83db"></a><!-- doxytag: member="kernel.h::create_mailbox" ref="a28699cab35eb5ea1e91a4e7c1c6b83db" args="(int nof_msg, int size_of_msg)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structmailbox.html">mailbox</a>* <a class="el" href="kernel_8h.html#a28699cab35eb5ea1e91a4e7c1c6b83db">create_mailbox</a> </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>nof_msg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>size_of_msg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Creates a new mailbox </p>

</div>
</div>
<a class="anchor" id="a42bfc62243f10c46ceee0712571ed02e"></a><!-- doxytag: member="kernel.h::create_task" ref="a42bfc62243f10c46ceee0712571ed02e" args="(void(*body)(), uint deadline)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">exception <a class="el" href="kernel_8h.html#a42bfc62243f10c46ceee0712571ed02e">create_task</a> </td>
          <td>(</td>
          <td class="paramtype">void(*)()&#160;</td>
          <td class="paramname"><em>task_body</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>deadline</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [final]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This function creates a task. If the call is made in startup mode, i.e. the kernel is not running, only the necessary data structures will be created. However, if the call is made in running mode, it will lead to a rescheduling and possibly a context switch. Argument </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">*task_body</td><td>A pointer to the C function holding the code of the task. </td></tr>
    <tr><td class="paramname">deadline</td><td>The kernel will try to schedule the task so it will meet this deadline. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Description of the functions status, i.e. FAIL/OK. </dd></dl>
<dl class="todo"><dt><b><a class="el" href="todo.html#_todo000003">Todo:</a></b></dt><dd>disable interupts </dd></dl>

</div>
</div>
<a class="anchor" id="a415bfbeeec9b4d8eabe0fa37ffd512fa"></a><!-- doxytag: member="kernel.h::deadline" ref="a415bfbeeec9b4d8eabe0fa37ffd512fa" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint <a class="el" href="kernel_8h.html#a415bfbeeec9b4d8eabe0fa37ffd512fa">deadline</a> </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This call will return the deadline of the specified task </p>

</div>
</div>
<a class="anchor" id="aad80019951ae95cf5df515d6d0ad1e93"></a><!-- doxytag: member="kernel.h::init_kernel" ref="aad80019951ae95cf5df515d6d0ad1e93" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="kernel_8h.html#aad80019951ae95cf5df515d6d0ad1e93">init_kernel</a> </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [final]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>exception <a class="el" href="kernel_8h.html#aad80019951ae95cf5df515d6d0ad1e93">init_kernel()</a> This function initializes the kernel and its data structures and leaves the kernel in start-up mode. The init_kernel call must be made before any other call is made to the kernel. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>parameter </dd></dl>
<dl class="todo"><dt><b><a class="el" href="todo.html#_todo000002">Todo:</a></b></dt><dd>Set tick counter to zero </dd></dl>

</div>
</div>
<a class="anchor" id="a712e1920162e49aa4597afe3a066057a"></a><!-- doxytag: member="kernel.h::receive_no_wait" ref="a712e1920162e49aa4597afe3a066057a" args="(mailbox *mBox, void *pData)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="kernel_8h.html#a712e1920162e49aa4597afe3a066057a">receive_no_wait</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structmailbox.html">mailbox</a> *&#160;</td>
          <td class="paramname"><em>mBox</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>Data</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [final]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This call will attempt to receive a Message from the specified Mailbox. The calling task will continue execution after the call. When there is no send Message available, or if the Mailbox is empty, the function will return FAIL. Otherwise, OK is returned. The call might imply a new scheduling and possibly a context switch. </p>

</div>
</div>
<a class="anchor" id="abd6f30918419645edbd5c37e4436ee8d"></a><!-- doxytag: member="kernel.h::receive_wait" ref="abd6f30918419645edbd5c37e4436ee8d" args="(mailbox *mBox, void *pData)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">exception <a class="el" href="kernel_8h.html#abd6f30918419645edbd5c37e4436ee8d">receive_wait</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structmailbox.html">mailbox</a> *&#160;</td>
          <td class="paramname"><em>mBox</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>Data</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [final]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This call will attempt to receive a Message from the specified Mailbox. If there is a send_wait or a send_no_wait Message waiting for a receive_wait or a receive_no_wait Message on the specified Mailbox, receive_wait will collect it. If the Message was of send_wait type the sending task will be moved to the Readylist. Otherwise, if there is not a send Message (of either type) waiting on the specified Mailbox, the receiving task will be blocked. In both cases (blocked or not blocked) a new task schedule is done and possibly a context switch. During the blocking period of the task its deadline might be reached. At that point in time the blocked task will be resumed with the exception: DEADLINE_REACHED. </p>

</div>
</div>
<a class="anchor" id="a05e0ffe612d44e6d7f3a9ae5b9df56a2"></a><!-- doxytag: member="kernel.h::run" ref="a05e0ffe612d44e6d7f3a9ae5b9df56a2" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="kernel_8h.html#a05e0ffe612d44e6d7f3a9ae5b9df56a2">run</a> </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This function starts the kernel and thus the system of created tasks. Since the call will start the kernel it will leave control to the task with tightest deadline. Therefore, it must be placed last in the application initialization code. After this call the system will be in running mode. </p>

</div>
</div>
<a class="anchor" id="a6a564f8696b23cb7392d26ccf028b81e"></a><!-- doxytag: member="kernel.h::send_no_wait" ref="a6a564f8696b23cb7392d26ccf028b81e" args="(mailbox *mBox, void *pData)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">exception <a class="el" href="kernel_8h.html#a6a564f8696b23cb7392d26ccf028b81e">send_no_wait</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structmailbox.html">mailbox</a> *&#160;</td>
          <td class="paramname"><em>mBox</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>Data</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [final]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This call will send a Message to the specified Mailbox. The sending task will continue execution after the call. When the Mailbox is full, the oldest Message will be overwritten. The send_no_wait call will imply a new scheduling and possibly a context switch. Note: send_wait and send_no_wait Messages shall not be mixed in the same Mailbox. </p>

</div>
</div>
<a class="anchor" id="a4b1dea31825f9001a59a30454ea4da92"></a><!-- doxytag: member="kernel.h::send_wait" ref="a4b1dea31825f9001a59a30454ea4da92" args="(mailbox *mBox, void *pData)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">exception <a class="el" href="kernel_8h.html#a4b1dea31825f9001a59a30454ea4da92">send_wait</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structmailbox.html">mailbox</a> *&#160;</td>
          <td class="paramname"><em>mBox</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>Data</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [final]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This call will send a Message to the specified Mailbox. If there is a receiving task waiting for a Message on the specified Mailbox, send_wait will deliver it and the receiving task will be moved to the Readylist. Otherwise, if there is not a receiving task waiting for a Message on the specified Mailbox, the sending task will be blocked. In both cases (blocked or not blocked) a new task schedule is done and possibly a context switch. During the blocking period of the task its deadline might be reached. At that point in time the blocked task will be resumed with the exception: DEADLINE_REACHED. Note: send_wait and send_no_wait Messages shall not be mixed in the same Mailbox. </p>

</div>
</div>
<a class="anchor" id="add8b1bafb2b27062dba1e95c376130de"></a><!-- doxytag: member="kernel.h::set_deadline" ref="add8b1bafb2b27062dba1e95c376130de" args="(uint nNew)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="kernel_8h.html#add8b1bafb2b27062dba1e95c376130de">set_deadline</a> </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>deadline</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This call will set the deadline for the calling task. The task will be rescheduled and a context switch might occur. </p>
<dl class="todo"><dt><b><a class="el" href="todo.html#_todo000004">Todo:</a></b></dt><dd>disable interupts </dd></dl>
<dl class="todo"><dt><b><a class="el" href="todo.html#_todo000005">Todo:</a></b></dt><dd>IF first execution THEN Set: ?not first execution any more? Set the deadline field in the calling TCB. Reschedule Readylist Load context ENDIF </dd></dl>

</div>
</div>
<a class="anchor" id="a8c4a8800ec94acdc9e79f493e175bbba"></a><!-- doxytag: member="kernel.h::set_ticks" ref="a8c4a8800ec94acdc9e79f493e175bbba" args="(uint no_of_ticks)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="kernel_8h.html#a8c4a8800ec94acdc9e79f493e175bbba">set_ticks</a> </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>nTicks</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This call will set the tick counter to the given value. </p>

</div>
</div>
<a class="anchor" id="a5354b26c0e92bc241bbaf8daedc5a28c"></a><!-- doxytag: member="kernel.h::terminate" ref="a5354b26c0e92bc241bbaf8daedc5a28c" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="kernel_8h.html#a5354b26c0e92bc241bbaf8daedc5a28c">terminate</a> </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This call will terminate the running task. All data structures for the task will be removed. Thereafter, another task will be scheduled for execution. </p>

</div>
</div>
<a class="anchor" id="ac8ec696caa3fec38a393173591ab4cac"></a><!-- doxytag: member="kernel.h::ticks" ref="ac8ec696caa3fec38a393173591ab4cac" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint <a class="el" href="kernel_8h.html#ac8ec696caa3fec38a393173591ab4cac">ticks</a> </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This call will return the current value of the tick counter </p>

</div>
</div>
<a class="anchor" id="ae600d2a164441d7ca5200fe978253a15"></a><!-- doxytag: member="kernel.h::wait" ref="ae600d2a164441d7ca5200fe978253a15" args="(uint nTicks)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">exception <a class="el" href="kernel_8h.html#ae600d2a164441d7ca5200fe978253a15">wait</a> </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>nTicks</em></td><td>)</td>
          <td><code> [final]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This call will block the calling task until the given number of ticks has expired. </p>

</div>
</div>
</div><!-- contents -->
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="kernel_8h.html">kernel.h</a>      </li>

    <li class="footer">Generated on Tue Jan 24 2012 15:04:14 for DST2-project by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>
   </ul>
 </div>


</body>
</html>
